package com.hxexp.weixin.test.api;

import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

import com.hxexp.weixin.common.exception.APIException;
import com.hxexp.weixin.hpe.api.ordersubmit.OrderSubmitAPI;
import com.hxexp.weixin.hpe.api.ordersubmit.model.OrderSubmitParamBean;
import com.hxexp.weixin.hpe.api.ordersubmit.model.OrderSubmitResultBean;
import com.hxexp.weixin.test.runner.JUnit4WithSpringLogClassRunner;

/**
 * 生成订单接口实现类测试
 *
 * @author wang.bin
 *
 */
@RunWith(JUnit4WithSpringLogClassRunner.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@ContextConfiguration(locations = { "classpath:conf/spring/spring-biz.xml", "classpath:conf/spring/spring-ehcache.xml" })
public class OrderSubmitAPIImplTester {

    @Autowired
    private OrderSubmitAPI orderSubmitAPI;

    @Test
    public void testCase01() throws APIException {

        OrderSubmitParamBean orderSubmitParamBean = new OrderSubmitParamBean();
        OrderSubmitResultBean returnValue = new OrderSubmitResultBean();
        // 设置请求参数
        orderSubmitParamBean.setUserId("16229bd2ca19455facd7df4dd030d0a1");
        orderSubmitParamBean.setStartStationId("646000001");
        orderSubmitParamBean.setArriveStationId("CD0");
        orderSubmitParamBean.setLeaveDate("2016-03-15");
        orderSubmitParamBean.setLeaveTime("09:00");
        orderSubmitParamBean.setRegBusNoFoid("13");
        orderSubmitParamBean.setRegBusNo("0112");
        orderSubmitParamBean.setTicketNum("1");
        orderSubmitParamBean.setFullTicketNum("1");
        orderSubmitParamBean.setHalfTicketNum("0");
        orderSubmitParamBean.setFreeTicketNum("0");
        orderSubmitParamBean.setPrice("103.50");
        orderSubmitParamBean.setHalfPrice("52.50");
        orderSubmitParamBean.setFullStationCharge("1.50");
        orderSubmitParamBean.setHalfStationCharge("1.50");
        orderSubmitParamBean.setChannelType("4");
        orderSubmitParamBean.setFullServicePrice("3.00");
        orderSubmitParamBean.setHalfServicePrice("3.00");
        orderSubmitParamBean.setPassengerTypeCSV("1,2");

        returnValue = orderSubmitAPI.orderSubmit(orderSubmitParamBean);
        System.out.println(returnValue);
    }
}
